<?
class My_View_Helper_ProfileLink
{
    public $view;

    public function setView(Zend_View_Interface $view)
    {
        $this->view = $view;
    }

    public function profileLink()
    {
        $link = '';
        $auth = Zend_Auth::getInstance();        
        if ($auth->hasIdentity()) {
            $user = $auth->getIdentity();
            if(!is_object($user)){
			    return $link;
		    }
            $link .='<a href="' . $this->view->url(array('controller'=>'participant', 'action' => 'profile'), 'default', true) . '">';
            $link .= $this->view->translate('welcome') . ', ' . $user->first_name . '</a>';
            $link .= '&nbsp|&nbsp<a href="' . $this->view->url(array('controller'=>'logout', 'action' => 'index'), 'default', true) . '">' . $this->view->translate('logout') . '</a>';
            return $link;
        }
        $link = '<a href="' . $this->view->url(array('controller'=>'login', 'action' => 'index'), 'default', true) . '">' . $this->view->translate('login') . '</a>';
        return $link;
    }
}